This tutorial includes how to create a Label in Xamarin and edit its appearance. If you want to know how to create a Label, it is recommended that you follow this tutorial.
In this section you will learn the following and you can do them easily:
- Create a Label in Xamarin.Forms
- Change the appearance of the label
- Insert Labels in different formats
What is a label?
Label is literally a word used to describe or identify an object and its content.Labels in the field of programming are the characters that specify a place in the source code. The identifier of this type of label is Cullen.Learn how to create a Label in Xamarin.Forms using Visual Studio
The requirements for creating and creating a label are as follows:
- Install the latest version of Visual Studio 2019
- Install Mobile development with .NET1- Open Visual Studio.
2- Create a new black Xamarin.Forms app . In this tutorial, we named it LabelTutorial.
3- It is better that the name of the solution is the same as the name of the project. Also call the solution LabelTutorial.
4- In order to get output from different platforms with one programming, you must make sure that it supports the .NET Standard mechanism for code sharing.
5- In the Solution Explorer section of the LabelTutorial project, click on the MainPage.xaml file and replace the code in that file with the code inserted below.
<! -? xml version = "1.0" encoding = "utf-8"? ->
<contentpage xmlns = "http://xamarin.com/schemas/2014/forms" xmlns: x = "http://schemas.microsoft.com/winfx/2009/xaml" x: class = "LabelTutorial.MainPage">
<stacklayout margin = "20,35,20,20">
<label text = "Welcome to Xamarin.Forms!" horizontaloptions = "Center">
</label> </stacklayout>
</contentpage>
This code actually defines a UI for the page and the UI contains a Label. The Label.Txt attribute is not the text that is to be inserted into the Label. The HorizontalOptions feature specifies that the Label is placed horizontally.- You can run the program by pressing the Start button or Ctrl + F5 key combination and see the result in the simulators.
Learn how to change the appearance of Label in Xamarin.Forms using Visual Studio
Label.TextDecorations attribute:
By setting and setting the Label.TextDecorations attribute, you can apply embellishments and changes to the text that will be placed inside the Label.
Appearance changes such as:
- None
- Underline
- StrikethroughFor example, the following code shows how to set and set the Label.TextDecorations attribute in the XAML file:
Read more on:https://www.dotnek.com/Blog/Apps/how-to-build-label-in-xamarin
link:https://dotnek.mystrikingly.com/
Related link:dotnek tech blog
:: برچسبها:
dotnek ,
seo ,
site ,
:: بازدید از این مطلب : 195
|
امتیاز مطلب : 63
|
تعداد امتیازدهندگان : 13
|
مجموع امتیاز : 13